﻿using System;
using System.Collections.Generic;
using System.Text;
using Web.Core;
using Web.Core.Objects;
using System.Collections;
using Web.Core;
using Web.Core.Providers;

namespace Web.Core.Objects
{
    public class Articles
    {
        public static ArrayList arr = new ArrayList();

        public static ArrayList getAllArticle(int lang)
        {
            return DataProvider.GetInstance().GetAllArticle(-1, "", "", lang);
        }

        public static Article getAllArticleByID(int id,int lang)
        {
            return DataProvider.GetInstance().GetAllArticle(id, "", "", lang)[0] as Article;
        }
        
        public static ArrayList getAllArticleByType(string type,int lang)
        {
            return DataProvider.GetInstance().GetAllArticle(-1, "", type, lang);
        }

        public static int UpdateArticle(Article art, ShopContent shop)
        {
            return DataProvider.GetInstance().CreateUpdateDeleteArticle(art, shop, GlobalStorage.Action.Update);
        }
        public static int InsertArticle(Article art, ShopContent shop)
        {
            return DataProvider.GetInstance().CreateUpdateDeleteArticle(art, shop, GlobalStorage.Action.Insert);
        }
        public static int DeleteArticle(Article art)
        {
            return DataProvider.GetInstance().CreateUpdateDeleteArticle(art, new ShopContent("", "", "", ""), GlobalStorage.Action.Delete);
        }
    }
}
